<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin: 0px;
        padding: 0px;
    }
    #div1{
        width: 1240px;
        height: 230px;
        border: 1px solid #000;
        margin: 5px auto;
        position: relative;
        overflow: hidden;
    }
    #ul1 {
        position: absolute;
    }
    #ul1 li {
        list-style: none;
        width: 300px;
        height: 220px;
        margin: 5px;
        float: left;
    }
    #ul1 li img {
        width: 100%;
        height: 100%;
    }
</style>
<script>
    window.onload = function() {
        var ul1 = document.getElementById("ul1");
        var div1 = document.getElementById("div1");
        ul1.innerHTML += ul1.innerHTML;
        ul1.style.width = 310 * 8 + 'px'

        // 匀速向左
        setInterval(function(){
            ul1.style.left = ul1.offsetLeft - 2 + 'px';
            if (ul1.offsetLeft == -ul1.offsetWidth / 2) {
                ul1.style.left = '0px'
            }            
        }, 30);
    }
</script>
<body>
    <div id="div1">
        <ul id="ul1">
            <li>
                <img src="1.jpg" alt="">
            </li>
            <li>
                <img src="2.jpg" alt="">
            </li>
            <li>
                <img src="3.jpg" alt="">
            </li>
            <li>
                <img src="4.jpg" alt="">
            </li>
        </ul>
    </div>
</body>
</html>